/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Core.impl;

import EA_Model.IEC61970.Core.BaseVoltage;
import EA_Model.IEC61970.Core.CorePackage;

import EA_Model.IEC61970.Domain.Voltage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Base Voltage</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Core.impl.BaseVoltageImpl#getIsDC <em>Is DC</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.BaseVoltageImpl#getNominalVoltage <em>Nominal Voltage</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BaseVoltageImpl extends IdentifiedObjectImpl implements BaseVoltage {
	/**
	 * The cached value of the '{@link #getIsDC() <em>Is DC</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIsDC()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean isDC;

	/**
	 * The cached value of the '{@link #getNominalVoltage() <em>Nominal Voltage</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNominalVoltage()
	 * @generated
	 * @ordered
	 */
	protected Voltage nominalVoltage;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BaseVoltageImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CorePackage.Literals.BASE_VOLTAGE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getIsDC() {
		if (isDC != null && isDC.eIsProxy()) {
			InternalEObject oldIsDC = (InternalEObject)isDC;
			isDC = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldIsDC);
			if (isDC != oldIsDC) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.BASE_VOLTAGE__IS_DC, oldIsDC, isDC));
			}
		}
		return isDC;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetIsDC() {
		return isDC;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIsDC(EA_Model.IEC61970.Domain.Boolean newIsDC) {
		EA_Model.IEC61970.Domain.Boolean oldIsDC = isDC;
		isDC = newIsDC;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BASE_VOLTAGE__IS_DC, oldIsDC, isDC));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage getNominalVoltage() {
		if (nominalVoltage != null && nominalVoltage.eIsProxy()) {
			InternalEObject oldNominalVoltage = (InternalEObject)nominalVoltage;
			nominalVoltage = (Voltage)eResolveProxy(oldNominalVoltage);
			if (nominalVoltage != oldNominalVoltage) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.BASE_VOLTAGE__NOMINAL_VOLTAGE, oldNominalVoltage, nominalVoltage));
			}
		}
		return nominalVoltage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage basicGetNominalVoltage() {
		return nominalVoltage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNominalVoltage(Voltage newNominalVoltage) {
		Voltage oldNominalVoltage = nominalVoltage;
		nominalVoltage = newNominalVoltage;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BASE_VOLTAGE__NOMINAL_VOLTAGE, oldNominalVoltage, nominalVoltage));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.BASE_VOLTAGE__IS_DC:
				if (resolve) return getIsDC();
				return basicGetIsDC();
			case CorePackage.BASE_VOLTAGE__NOMINAL_VOLTAGE:
				if (resolve) return getNominalVoltage();
				return basicGetNominalVoltage();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.BASE_VOLTAGE__IS_DC:
				setIsDC((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case CorePackage.BASE_VOLTAGE__NOMINAL_VOLTAGE:
				setNominalVoltage((Voltage)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.BASE_VOLTAGE__IS_DC:
				setIsDC((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case CorePackage.BASE_VOLTAGE__NOMINAL_VOLTAGE:
				setNominalVoltage((Voltage)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.BASE_VOLTAGE__IS_DC:
				return isDC != null;
			case CorePackage.BASE_VOLTAGE__NOMINAL_VOLTAGE:
				return nominalVoltage != null;
		}
		return super.eIsSet(featureID);
	}

} //BaseVoltageImpl
